// API常量定义

// HTTP状态码
export const HTTP_STATUS = {
  OK: 200,
  CREATED: 201,
  BAD_REQUEST: 400,
  UNAUTHORIZED: 401,
  FORBIDDEN: 403,
  NOT_FOUND: 404,
  INTERNAL_SERVER_ERROR: 500
}

// 业务状态码
export const BUSINESS_CODE = {
  SUCCESS: 200,
  ERROR: 500,
  UNAUTHORIZED: 401,
  FORBIDDEN: 403,
  NOT_FOUND: 404,
  VALIDATION_ERROR: 422
}

// API端点
export const API_ENDPOINTS = {
  // 用户相关
  USER: {
    LOGIN: '/user/login',
    REGISTER: '/user/register',
    INFO: '/user/info',
    LOGOUT: '/user/logout'
  },

  // 日记相关
  DIARY: {
    LIST: '/diary',
    DETAIL: '/diary/:id',
    CREATE: '/diary',
    UPDATE: '/diary/:id',
    DELETE: '/diary/:id',
    UPLOAD: '/diary/upload'
  },

  // 地点相关
  LOCATION: {
    LIST: '/location',
    SEARCH: '/location/search',
    CREATE: '/location'
  },

  // 统计相关
  STATS: {
    TRAVEL: '/stats/travel',
    MONTHLY: '/stats/monthly'
  }
}

// 请求方法
export const HTTP_METHODS = {
  GET: 'get',
  POST: 'post',
  PUT: 'put',
  DELETE: 'delete',
  PATCH: 'patch'
}

// 内容类型
export const CONTENT_TYPES = {
  JSON: 'application/json',
  FORM_DATA: 'multipart/form-data',
  URL_ENCODED: 'application/x-www-form-urlencoded'
}

// 错误消息
export const ERROR_MESSAGES = {
  NETWORK_ERROR: '网络连接失败',
  TIMEOUT_ERROR: '请求超时',
  SERVER_ERROR: '服务器错误',
  UNAUTHORIZED: '未授权，请重新登录',
  FORBIDDEN: '拒绝访问',
  NOT_FOUND: '请求的资源不存在',
  VALIDATION_ERROR: '请求参数错误'
}

// 成功消息
export const SUCCESS_MESSAGES = {
  LOGIN_SUCCESS: '登录成功',
  REGISTER_SUCCESS: '注册成功',
  LOGOUT_SUCCESS: '登出成功',
  SAVE_SUCCESS: '保存成功',
  DELETE_SUCCESS: '删除成功',
  UPDATE_SUCCESS: '更新成功'
}
